<?php

namespace common\models\datas;

use Yii;

/**
 * This is the model class for table "{{%category_option}}".
 *
 * @property string $id
 * @property integer $category_id
 * @property integer $is_show_pc
 * @property string $pc_image
 * @property integer $is_show_wechat
 * @property string $wechat_image
 */
class CategoryOption extends \common\components\bases\BaseModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%category_option}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['category_id', 'is_show_pc', 'is_show_wechat'], 'required'],
            [['category_id', 'is_show_pc', 'is_show_wechat'], 'integer'],
            [['pc_image', 'wechat_image'], 'string', 'max' => 100]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('common', 'ID'),
            'category_id' => Yii::t('common', '分类ID'),
            'is_show_pc' => Yii::t('common', 'pc端是否显示'),
            'pc_image' => Yii::t('common', 'pc端图标'),
            'is_show_wechat' => Yii::t('common', '微信端是否显示'),
            'wechat_image' => Yii::t('common', '微信端图标'),
        ];
    }

    public function getCategory()
    {
        return $this->hasOne(Category::className(), ['id' => 'category_id']);
    }
}
